function binarySearch (target, arr){
	var start = 0,
		end = arr.length-1,
		cnt = 0;
	while (start <= end){
		var mid = parseInt( (start + end )/2);
		cnt++;
		if (target == arr[mid]) {
			console.log('共查询了'+ cnt +'次');
			return mid;
			}
		else if (target > arr[mid]){
			start = mid + 1;
		}
		else
			end = mid - 1;
	}
	return -1;
}
var arr = [1, 2, 5, 6, 9, 11, 14, 17, 25, 36];
var index = binarySearch (6, arr);
console.log(index);